/**
 * Copyright 2010 Andreas Keefer
 *
 * This file is part of jHashMe.
 *
 * jHashMe is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * jHashMe is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with jHashMe.  If not, see <http://www.gnu.org/licenses/>.
 */

package de.jhashme.hash.service;

import java.io.File;
import java.io.IOException;

/**
 * Represents an HashAlgorithm.
 * </p>
 * If you want to provide an new hash algorithm,
 * then you must implement this interface and register the Service
 * in the OSGi Framework and deploy the OSGi-bundle in jHashMe. 
 */
public interface HashServiceProvider {

    /**
     * Returns Metadata to the HashAlgorithm which is implemented in this Service.
     *
     * @return Algorithm Metadata.
     */
    public HashAlgorithm getHashAlgorithm();

    /**
     * Calculate the Hash of an String
     *
     * @param textToHash The Text which should be hashed.
     * @return The Hash value of textToHash.
     */
    public String calculateHash(String textToHash);

    /**
     * Calculate the Hash of an File
     *
     * @param fileToHash The file which should be hashed.
     * @return The hash value of the file.
     * @throws IOException if IO Error occurred (file not found, ...).
     */
    public String calculateHash(File fileToHash) throws IOException;
}
